jQuery(document).ready(function($) { //$('#cep_casa').numpad(); switchButton(); $('.navbar-toggle').click(function(event) { event.preventDefault(); $(this).toggleClass('collapsed'); $('.navbar-main-navigation').toggleClass('in'); $('#wpadminbar').toggleClass('navbar-in'); if($('.navbar-main-navigation').hasClass('in')){ $(window).scroll(function () { $(window).scrollTop(0); }); }else{ $(window).off('scroll'); } }); $('.slides-menu .slide-anchor').click(function(event) { event.preventDefault(); $('.slides-menu .slide-anchor').removeClass('active'); $(this).addClass('active'); var slide = $(this).attr('href'); slide = $(slide); if(slide.hasClass('active')){ return; }else{ $('.slides .item').not(slide).removeClass('active'); slide.addClass('active'); } }); owlSeguradoras = $('#seguradoras .owl-carousel'); owlSeguradoras.owlCarousel({ loop:true, margin:10, nav:true, autoplay: true, navText:'', responsive:{ 0:{ items:1 }, 600:{ items:3 }, 1000:{ items:5 } } }); $('.testimonials .testimonials-slider').owlCarousel({ loop:false, margin:0, dots:false, nav: true, autoplay: true, //lazyLoad:true, navText: '', responsive:{ 0:{ items:1 } } }); var $validator = $("#insurance-form-auto").validate({ // rules: { // // emailfield: { // // required: true, // // email: true, // // minlength: 3 // // }, // nome: { // required: true, // minlength: 3 // }, // // urlfield: { // // required: true, // // minlength: 3, // // url: true // // } // }, // messages: { // name: { // required: "Nome é obrigatório", // minlength: jQuery.validator.format("At least {0} characters required!") // } // // email: { // // required: "We need your email address to contact you", // // email: "Your email address must be in the format of name@domain.com" // // } // } }); var $validatorhouse = $("#insurance-form-house").validate({ // rules: { // // emailfield: { // // required: true, // // email: true, // // minlength: 3 // // }, // nome: { // required: true, // minlength: 3 // }, // // urlfield: { // // required: true, // // minlength: 3, // // url: true // // } // }, // messages: { // name: { // required: "Nome é obrigatório", // minlength: jQuery.validator.format("At least {0} characters required!") // } // // email: { // // required: "We need your email address to contact you", // // email: "Your email address must be in the format of name@domain.com" // // } // } }); var $validatorapartament = $("#insurance-form-apartament").validate({ // rules: { // // emailfield: { // // required: true, // // email: true, // // minlength: 3 // // }, // nome: { // required: true, // minlength: 3 // }, // // urlfield: { // // required: true, // // minlength: 3, // // url: true // // } // }, // messages: { // name: { // required: "Nome é obrigatório", // minlength: jQuery.validator.format("At least {0} characters required!") // } // // email: { // // required: "We need your email address to contact you", // // email: "Your email address must be in the format of name@domain.com" // // } // } }); $( "#nome" ).rules( "add", { required: true, minlength: 3, messages: { nome: { required: "Nome é obrigatório", minlength: jQuery.validator.format("At least {0} characters required!"), } // email: { // required: "We need your email address to contact you", // email: "Your email address must be in the format of name@domain.com" // } } }); $( ".complemento_apartament" ).rules( "add", { required: false, }); $( ".data_vencimento_apartament" ).rules( "add", { required: false, }); $( ".bonus_input_apartament" ).rules( "add", { required: false, }); // $('.insurance-form#insurance-form-auto').bootstrapWizard({ // 'onTabShow': function(tab, navigation, index) { // var $total = navigation.find('li').length; // var $current = index+1; // var $percent = ($current/$total) * 100; // $('#rootwizard').find('.bar').css({width:$percent+'%'}); // $('#insurance-form-auto .nav li.active').removeClass('done'); // }, // 'onTabClick': function(tab, navigation, index) { // // console.log('on tab click disabled'); // return false; // }, // 'onNext': function(tab, navigation, index) { // var $valid = $("#insurance-form-auto").valid(); // // console.log('next'); // // console.log('valid? '+$valid); // $('#insurance-form-auto .nav li').removeClass('done'); // $('#insurance-form-auto .nav li').each(function(index, el) { // if($valid && $(this).hasClass('active')){ // $(this).addClass('done'); // return false; // } // else if($(this).hasClass('active') && !$valid){ // return false; // }else{ // $(this).addClass('done'); // } // }); // if(!$valid) { // $validator.focusInvalid(); // return false; // } // }, // 'onPrev': function(tab, navigation, index) { // $('#insurance-form-auto .nav li').removeClass('done'); // $('#insurance-form-auto .nav li').each(function(index, el) { // if($(this).hasClass('active')){ // $(this).removeClass('done'); // } // }); // }, // }); // $('.insurance-form#insurance-form-house').bootstrapWizard({ // onTabShow: function(tab, navigation, index) { // var $total = navigation.find('li').length; // var $current = index+1; // var $percent = ($current/$total) * 100; // $('#rootwizard').find('.bar').css({width:$percent+'%'}); // $('#insurance-form-house .nav li.active').removeClass('done'); // }, // 'onTabClick': function(tab, navigation, index) { // // console.log('on tab click disabled'); // return false; // }, // 'onNext': function(tab, navigation, index) { // var $valid = $("#insurance-form-house").valid(); // // console.log('next'); // // console.log('valid? '+$valid); // $('#insurance-form-house .nav li').removeClass('done'); // $('#insurance-form-house .nav li').each(function(index, el) { // if($valid && $(this).hasClass('active')){ // $(this).addClass('done'); // return false; // } // else if($(this).hasClass('active') && !$valid){ // return false; // }else{ // $(this).addClass('done'); // } // }); // if(!$valid) { // $validatorhouse.focusInvalid(); // return false; // } // }, // 'onPrev': function(tab, navigation, index) { // $('#insurance-form-house .nav li').removeClass('done'); // $('#insurance-form-house .nav li').each(function(index, el) { // if($(this).hasClass('active')){ // $(this).removeClass('done'); // } // }); // }, // }); // wizardApartment = $('.insurance-form#insurance-form-apartament').bootstrapWizard({ // onTabShow: function(tab, navigation, index) { // var $total = navigation.find('li').length; // var $current = index+1; // var $percent = ($current/$total) * 100; // $('#rootwizard').find('.bar').css({width:$percent+'%'}); // $('#insurance-form-apartament .nav li.active').removeClass('done'); // }, // 'onTabClick': function(tab, navigation, index) { // // console.log('on tab click disabled'); // return false; // }, // 'onNext': function(tab, navigation, index) { // var $valid = $("#insurance-form-apartament").valid(); // // console.log('next'); // // console.log('valid? '+$valid); // $('#insurance-form-apartament .nav li').removeClass('done'); // $('#insurance-form-apartament .nav li').each(function(index, el) { // if($valid && $(this).hasClass('active')){ // $(this).addClass('done'); // return false; // } // else if($(this).hasClass('active') && !$valid){ // return false; // }else{ // $(this).addClass('done'); // } // }); // if(!$valid) { // $validatorapartament.focusInvalid(); // return false; // } // }, // 'onPrev': function(tab, navigation, index) { // $('#insurance-form-apartament .nav li').removeClass('done'); // $('#insurance-form-apartament .nav li').each(function(index, el) { // if($(this).hasClass('active')){ // $(this).removeClass('done'); // } // }); // }, // }); // $('.insurance-form#insurance-form-auto').bootstrapWizard({ // onTabShow: function(tab, navigation, index) { // var $total = navigation.find('li').length; // var $current = index+1; // var $percent = ($current/$total) * 100; // $('#rootwizard').find('.bar').css({width:$percent+'%'}); // } // }); // $('.insurance-form .finish').click(function(event) { // // var form = $($(this).context.parentElement.parentElement.parentElement); // event.preventDefault(); // var home = window.location.origin; // // var data_1 = form.serializeArray(); // // var request = $.ajax( // { // url: home + '/new/wp-admin/admin-ajax.php?action=send_insurance&' + new Date().getTime(), // type: 'POST', // data: JSON.stringify(data_1), // dataType: 'json', // processData: false, // contentType: 'application/json; charset=utf-8', // success: function(res) // { // //console.log(res); // if(!res.result) // { // var classAllert = 'alert-danger'; // //console.log(res.result); // console.log(res.errors); // var message = res.errors; // } // else // { // var classAllert = 'alert-success'; // var message = 'Seu pedido de cotação foi enviado com sucesso.'; // } // form.find('#content-alert').html( // '